package com.stb.llh.util;


import com.alibaba.fastjson.JSON;
import lombok.Data;

/**
 * @Author Lee
 * @Date 2021/11/2
 * @Description
 */

@Data
public class
ResJson {

    private  int code;
    private  String msg;
    private Object data;


    public ResJson() {
    }

    public ResJson(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResJson(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static String getSuccess(Object data){
        ResJson res = new ResJson(200, "成功", data);

        return JSON.toJSONString(res);
    }

    public static String getError(Object data){
        return JSON.toJSONString(new ResJson(404,"失败",data));
    }

//    自定义
    public static ResJson getMsg(){
        return new ResJson();
    }
}
